total = 100

primes = []

twin = []

for num in range(1, total + 1):
    is_prime = True
    for i in range(2, int(num**0.5) + 1):
        if num % i == 0:
            is_prime = False
            break
    if is_prime:
        primes.append(num)

next = 0
front = 0

for i in primes:
    if i != primes[-1]:
        next = primes[primes.index(i) + 1]
    if i != primes[0]:
        front = primes[primes.index(i) - 1]
    if next - i == 2 and [i, next] not in twin:
        twin.append([i, next])
    elif i - front == 2 and [front, i] not in twin:
        twin.append([front, i])

print(twin)
